<template>
	<view class="">
		<view v-if="myData.length > 0" v-for="item,index in myData" :key="index">
			<navigator :url="'/pages/detail/detail?id=' + item.dId">
				<u-card :title="item.dTitle" :sub-title="item.dUpdatetime" :thumb="item.dPicture">
					<view class="" slot="body">
						<view class="u-body-item u-flex u-border-bottom u-col-between u-p-t-0">
							<view class="u-body-item-title u-line-2">{{item.dContent}}</view>
							<image :src="item.dPicture" mode="aspectFill"></image>
						</view>
					</view>
					<view class="foot" slot="foot">
						<u-icon name="thumb-up-fill" size="34" color="" :label="item.dFavorite"></u-icon>
						<u-icon name="trash" size="34" color=""></u-icon>
					</view>
				</u-card>
			</navigator>
		</view>
		<view class="empty" v-if="myData.length === 0">
			<u-empty text="开启你的第一篇点评吧!" mode="list"></u-empty>
		</view>
		
	</view>
</template>

<script>
export default {
	data() 
	{
		return {
			title: '素胚勾勒出青花，笔锋浓转淡',
			subTitle: '2020-05-15',
			thumb: 'http://pic2.sc.chinaz.com/Files/pic/pic9/202002/hpic2119_s.jpg',
			myData:[]
		}
	},
	async onLoad() 
	{
		let params = {
			pageNum:1,
			pageSize:5,
			id:this.vuex_token.openid
		}
		let res = await this.$u.api.getByIdDiscuss(params)
		res.records.forEach(item => {
			if(item.dPicture !== null)
				item.dPicture = item.dPicture.split(",")[0]
		})
		if(res.records.length > 0)
			this.myData.push(...res.records)
		else
			this.myData = res.records
		
		this.myData = res.records
		console.log(this.myData);
	},
	methods:{
		
	}
};
</script>

<style scoped lang="scss">
	.u-card-wrap { 
		background-color: $u-bg-color;
		padding: 1px;
	}
	.u-body-item {
		font-size: 32rpx;
		color: #333;
		padding: 20rpx 10rpx;
	}
	.u-body-item image {
		width: 120rpx;
		flex: 0 0 120rpx;
		height: 120rpx;
		border-radius: 8rpx;
		margin-left: 12rpx;
	}
	.empty
	{
		margin-top: 200rpx;
	}
	.foot
	{
		display: flex;
		justify-content: space-between;
	}
</style>
